$(function(){
    var NowPage=$("#NowPage").text();
    /**
     * 查询请求
     */
    $("#selectUser").click(function(){
        var userNumber=$("#userNumber").val();
        var userName=$("#userName").val();
        var registerState=$('#registerState option:selected').val();
        alert(userNumber+":"+userName+":"+registerState);
    });
    /**
     * 上一页请求
     */
    $("#PreviousPage").click(function () {
        $(location).attr('href', '/MiYiTuKu/Management/Users/'+(parseInt(NowPage)-1));
    });
    /**
     * 下一页请求
     */
    $("#NextPage").click(function(){
        $(location).attr('href', '/MiYiTuKu/Management/Users/'+(parseInt(NowPage)+1));
    });

    /**
     * 定义操作用户插件
     */
    $.extend({
        "operationUser":function(element,operationUser){
            var userId=element.parent().attr("alt");
            $.post("/MiYiTuKu/Management/Users/operationUserUser",{"userId":userId,"operationUser":operationUser},function(result){
                window.location.reload();
            });
        }
    });
    $(document).on("click",".add",function(){
        $.operationUser($(this),"add");
    });
    $(document).on("click",".prohibit",function(){
        $.operationUser($(this),"prohibit");
    });
    $(document).on("click",".delete",function(){
        $.operationUser($(this),"delete");
    });
});